import 'package:flutter/material.dart';
import 'package:x3_base_package/x3_base_package.dart';

class SearchBarExpansionBtnWidget extends StatelessWidget {
  final VoidCallback onClear;
  final VoidCallback onAdd;

  const SearchBarExpansionBtnWidget({Key key, this.onClear, this.onAdd}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Visibility(visible: onClear != null, child: Container(margin: EdgeInsets.only(right: 4), child: _buildContainer(Icons.delete_outline, this.onClear))),
        Visibility(visible: onAdd != null, child: _buildContainer(Icons.add, this.onAdd)),
      ],
    );
  }

  Widget _buildContainer(IconData icon, VoidCallback onPress) {
    return Container(
      width: 26,
      child: BaseIconButton(icon: icon, onPress: onPress),
    );
  }
}
